﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using WPFDevelopers.Samples.Models;

namespace WPFDevelopers.Samples.ViewModels
{
    public class Win10MenuExampleVM
    {
        private ObservableCollection<NavigateMenuModel> _navigateMenuModelList;
        public ObservableCollection<NavigateMenuModel> NavigateMenuModelList
        {
            get { return _navigateMenuModelList; }
            set { _navigateMenuModelList = value; }
        }

        private ObservableCollection<ListBoxItem> _listBoxItem;
        public ObservableCollection<ListBoxItem> ListBoxItemList
        {
            get { return _listBoxItem; }
            set { _listBoxItem = value; }
        }




        public Win10MenuExampleVM()
        {
            _navigateMenuModelList = new ObservableCollection<NavigateMenuModel>();
            _navigateMenuModelList.Add(new NavigateMenuModel()
            {
                Name = "会员管理"
            });
            _navigateMenuModelList.Add(new NavigateMenuModel()
            {
                Name = "系统字典"
            });
            _navigateMenuModelList.Add(new NavigateMenuModel()
            {
                Name = "用户管理"
            });
            _navigateMenuModelList.Add(new NavigateMenuModel()
            {
                Name = "系统设置"
            });
            _listBoxItem = new ObservableCollection<ListBoxItem>();
            for (int i = 0; i < 100; i++)
            {
                _listBoxItem.Add(new ListBoxItem()
                {
                    Content = "第" + i + "数据内容",
                    Name = "第" + i + "数据内容",
                    ToolTip = "第" + i + "数据内容",
                });
            }
        }


        public void GetListItemById(int id)
        {
            List<MenuMode> menuList = new List<MenuMode>();
            this.ListBoxItemList.Clear();
            switch (id)
            {
                case 0:
                    menuList.Clear();
                    menuList.Add(new MenuMode()
                    {
                        Name = "会员管理",
                        PName = "主页",
                        Url = "/PageViews/MemberManage.xaml",
                    });
                    menuList.Add(new MenuMode()
                    {
                        Name = "充值记录",
                        PName = "充值记录",
                        Url = "/PageViews/RechargeList.xaml",
                    });
                    menuList.Add(new MenuMode()
                    {
                        Name = "系统字典",
                        PName = "系统字典",
                        Url = "/PageViews/SystemDic.xaml",
                    });


                    foreach (var item in menuList)
                    {
                        _listBoxItem.Add(new ListBoxItem()
                        {
                            Content = item.Name,
                            Name = item.Name,
                            ToolTip = item.Name,
                            Tag = item
                        });
                    }
                    break;
                case 1:
                    menuList.Add(new MenuMode()
                    {
                        Name = "单据管理",
                        PName = "单据管理",
                        Url = "/PageViews/MemberManage.xaml",
                    });
                    foreach (var item in menuList)
                    {
                        _listBoxItem.Add(new ListBoxItem()
                        {
                            Content = item.Name,
                            Name = item.Name,
                            ToolTip = item.Name,
                            Tag = item
                        });
                    }
                    break;
                case 2:
                    break;
                case 3:
                    break;
            }
        }
    }
}
